from django.db import models


class Category(models.Model):
    id = models.AutoField(primary_key=True, max_length=100)
    name = models.CharField(max_length=100)

    class Meta:
        db_table = 'category'


class Article(models.Model):
    title = models.CharField(max_length=200)
    content = models.TextField()
    category = models.ForeignKey('Category', on_delete=models.CASCADE, null=True)
    creat_time = models.DateTimeField(auto_now_add=True, null=True)

    # def __str__(self):
    #     return self.title + self.content
    class Meta:
        db_table = 'article'
